Olaf adds support for Geonet.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 31 Aug 2005 14:45:28 +0000 (14:45 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 31 Aug 2005 14:45:28 +0000 (14:45 +0000)
gpsbabel/Makefile
gpsbabel/README
gpsbabel/internal_styles.c
gpsbabel/reference/geonet-sample.gpx [new file with mode: 0644]
gpsbabel/reference/geonet-sample.txt [new file with mode: 0644]
gpsbabel/style/geonet.style [new file with mode: 0644]
gpsbabel/xcsv.c

index f3fac011f752389efccbb259872e71c311f8f36f..037069ac2f6add949f235917449650fdf2c0d452 100644 (file)
@@ -391,5 +391,5 @@ jeeps/gpsutil.o: jeeps/gpsutil.c jeeps/gps.h jeeps/../defs.h \
   jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h
 shapelib/dbfopen.o: shapelib/dbfopen.c shapelib/shapefil.h
 shapelib/shpopen.o: shapelib/shpopen.c shapelib/shapefil.h
-internal_styles.c: mkstyle.sh style/README.style style/arc.style style/csv.style style/custom.style style/dna.style style/fugawi.style style/gpsdrive.style style/gpsdrivetrack.style style/gpsman.style style/mapconverter.style style/mxf.style style/nima.style style/openoffice.style style/s_and_t.style style/saplus.style style/tabsep.style style/xmap.style style/xmapwpt.style
+internal_styles.c: mkstyle.sh style/README.style style/arc.style style/csv.style style/custom.style style/dna.style style/fugawi.style style/geonet.style style/gpsdrive.style style/gpsdrivetrack.style style/gpsman.style style/mapconverter.style style/mxf.style style/nima.style style/openoffice.style style/s_and_t.style style/saplus.style style/tabsep.style style/xmap.style style/xmapwpt.style
        ./mkstyle.sh > internal_styles.c || (rm -f internal_styles.c ; exit 1)
index c6c57083fa1bcfec107aa7031eeee47dab1604e0..c8ea31061d39d0919102de012607f06a8909865c 100644 (file)
@@ -1016,10 +1016,17 @@ THE FORMATS
        Intended to serve as source for number-processing applications
        like OpenOffice, Ploticus and others. Tab was chosen as delimiter
        because it is a) supported by both OpenOffice and Ploticus and
-       b) is not ',', so you can use 'sed -i "s/./,/g" <x>.csv' to adapt it to
-       locales where ',' is used as decimal seperator.
+       b) is not ',', so you can use 'sed -i "s/./,/g" <x>.csv' to adapt 
+       it to locales where ',' is used as decimal seperator.
        Contributed by Tobias Minich.
        
+    GEOnet
+    
+       Input support for the GEOnet Names Server (GNS) country file 
+       structure.  Export to this format is not possible, as this format 
+       has too many fields that we never get populated by any other format.
+       
+       
 DATA FILTERS
 
         GPSBabel supports data filtering.  Data filters are invoked from
index 4093cc952bf6e1da11457e08e3d3d2e5624fb8ef..59d773cb86c2c0c89a499bc815a7d0699ba8d8b9 100644 (file)
@@ -216,6 +216,57 @@ static char garmin301[] =
 "#EPILOGUE     Epilogue Line 1\n"
 "#EPILOGUE     Epilogue Line 2\n"
 ;
+static char geonet[] = 
+"# gpsbabel XCSV style file\n"
+"#\n"
+"# Format: GEOnet Names Server (GNS) (http://earth-info.nga.mil/gns/html/cntry_files.html)\n"
+"# Author: Olaf Klein\n"
+"#   Date: 08/20/2002\n"
+"#\n"
+
+"DESCRIPTION           GEOnet Names Server (GNS)\n"
+"EXTENSION             txt\n"
+
+"#\n"
+"# FILE LAYOUT DEFINITIIONS:\n"
+"#\n"
+
+"FIELD_DELIMITER               TAB\n"
+"RECORD_DELIMITER      CRNEWLINE\n"
+"BADCHARS              TAB\n"
+"ENCODING              UTF-8\n"
+
+"PROLOGUE              RC      UFI     UNI     LAT     LONG    DMS_LAT DMS_LONG        UTM     JOG     FC      DSG     PC      CC1     ADM1    ADM2    DIM     CC2     NT      LC      SHORT_FORM      GENERIC SORT_NAME       FULL_NAME       FULL_NAME_ND    MODIFY_DATE\n"
+
+"#\n"
+"# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:\n"
+"#\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # RC            ( http://earth-info.nga.mil/gns/html/gis_contryfiles.html )\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # UFI\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # UNI\n"
+"IFIELD        LAT_DECIMAL, \"\", \"%03.7f\"   # LAT\n"
+"IFIELD        LON_DECIMAL, \"\", \"%03.7f\"   # LONG\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # DMS_LAT\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # DMS_LONG\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # UTM\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # JOG\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # FC\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # DSG\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # PC\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # CC1\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # ADM1\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # ADM2\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # DIM\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # CC2\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # NT\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # LC\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # SHORT_FORM\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # GENERIC\n"
+"IFIELD        SHORTNAME, \"\", \"%s\"         # SHORT_NAME\n"
+"IFIELD        DESCRIPTION, \"\", \"%s\"               # FULL_NAME\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # FULL_NAME_ND\n"
+"IFIELD        IGNORE, \"\", \"%s\"            # MOD_DATE\n"
+;
 static char gpsdrive[] = 
 "# gpsbabel XCSV style file\n"
 "#\n"
@@ -686,5 +737,5 @@ static char xmapwpt[] =
 "IFIELD        DESCRIPTION, \"\", \"%-.78s\"\n"
 ;
 #include "defs.h"
-style_vecs_t style_list[] = {{ "xmapwpt", xmapwpt } , { "xmap", xmap } , { "tabsep", tabsep } , { "saplus", saplus } , { "s_and_t", s_and_t } , { "openoffice", openoffice } , { "nima", nima } , { "mxf", mxf } , { "mapconverter", mapconverter } , { "gpsman", gpsman } , { "gpsdrivetrack", gpsdrivetrack } , { "gpsdrive", gpsdrive } , { "garmin301", garmin301 } , { "fugawi", fugawi } , { "dna", dna } , { "custom", custom } , { "csv", csv } , { "arc", arc } ,  {0,0}};
-size_t nstyles = 18;
+style_vecs_t style_list[] = {{ "xmapwpt", xmapwpt } , { "xmap", xmap } , { "tabsep", tabsep } , { "saplus", saplus } , { "s_and_t", s_and_t } , { "openoffice", openoffice } , { "nima", nima } , { "mxf", mxf } , { "mapconverter", mapconverter } , { "gpsman", gpsman } , { "gpsdrivetrack", gpsdrivetrack } , { "gpsdrive", gpsdrive } , { "geonet", geonet } , { "garmin301", garmin301 } , { "fugawi", fugawi } , { "dna", dna } , { "custom", custom } , { "csv", csv } , { "arc", arc } ,  {0,0}};
+size_t nstyles = 19;
diff --git a/gpsbabel/reference/geonet-sample.gpx b/gpsbabel/reference/geonet-sample.gpx
new file mode 100644 (file)
index 0000000..67c7af6
--- /dev/null
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gpx
+ version="1.0"
+creator="GPSBabel - http://www.gpsbabel.org"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xmlns="http://www.topografix.com/GPX/1/0"
+xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
+<time>2005-08-30T20:58:28Z</time>
+<bounds minlat="50.500000000" minlon ="12.133333300" maxlat="51.133333300" maxlon="13.716666700" />
+<wpt lat="51.016666700" lon="13.716666700">
+  <name>PLAUEN</name>
+  <cmt>Plauen</cmt>
+  <desc>Plauen</desc>
+</wpt>
+<wpt lat="50.500000000" lon="12.133333300">
+  <name>PLAUEN</name>
+  <cmt>Plauen</cmt>
+  <desc>Plauen</desc>
+</wpt>
+<wpt lat="50.500000000" lon="12.133333300">
+  <name>PLAUEN STADTKREIS</name>
+  <cmt>Stadtkreis Plauen</cmt>
+  <desc>Stadtkreis Plauen</desc>
+</wpt>
+<wpt lat="50.533333300" lon="12.133333300">
+  <name>PLAUENERSTADTWALD</name>
+  <cmt>Plauener Stadtwald</cmt>
+  <desc>Plauener Stadtwald</desc>
+</wpt>
+<wpt lat="51.133333300" lon="13.050000000">
+  <name>ZSCHOPAU</name>
+  <cmt>Zschopau</cmt>
+  <desc>Zschopau</desc>
+</wpt>
+<wpt lat="50.750000000" lon="13.066666700">
+  <name>ZSCHOPAU</name>
+  <cmt>Zschopau</cmt>
+  <desc>Zschopau</desc>
+</wpt>
+<wpt lat="50.866666700" lon="12.416666700">
+  <name>ZSCHOPEL</name>
+  <cmt>Zschöpel</cmt>
+  <desc>Zschöpel</desc>
+</wpt>
+<wpt lat="50.733333300" lon="13.066666700">
+  <name>ZSCHOPENBERG</name>
+  <cmt>Zschopen-Berg</cmt>
+  <desc>Zschopen-Berg</desc>
+</wpt>
+<wpt lat="50.766666700" lon="13.100000000">
+  <name>ZSCHOPENTHAL</name>
+  <cmt>Zschopenthal</cmt>
+  <desc>Zschopenthal</desc>
+</wpt>
+</gpx>
diff --git a/gpsbabel/reference/geonet-sample.txt b/gpsbabel/reference/geonet-sample.txt
new file mode 100644 (file)
index 0000000..d6c8979
--- /dev/null
@@ -0,0 +1,10 @@
+RC     UFI     UNI     LAT     LONG    DMS_LAT DMS_LONG        UTM     JOG     FC      DSG     PC      CC1     ADM1    ADM2    DIM     CC2     NT      LC      SHORT_FORM      GENERIC SORT_NAME       FULL_NAME       FULL_NAME_ND    MODIFY_DATE\r
+1      -1843626        -2549662        51.0166667      13.7166667      510100  134300  VS05    NM33-01 P       PPLX            GM      13                              N                               PLAUEN  Plauen  Plauen  1994-01-08\r
+1      -1843625        -2549661        50.5    12.1333333      503000  120800  TR99    NM33-04 P       PPL     3       GM      13                              N                               PLAUEN  Plauen  Plauen  2002-05-02\r
+1      -1843628        -2549664        50.5    12.1333333      503000  120800  TR99    NM33-04 A       ADM3            GM      13      Chemnitz                        V                               PLAUEN STADTKREIS       Stadtkreis Plauen       Stadtkreis Plauen       1998-04-28\r
+1      -1843629        -2549666        50.5333333      12.1333333      503200  120800  TS90    NM33-04 V       FRST            GM      13                              N                               PLAUENERSTADTWALD       Plauener Stadtwald      Plauener Stadtwald      1998-05-12\r
+1      -1893314        -2603706        51.1333333      13.05   510800  130300  US66    NM33-01 H       STM             GM      13                              N                               ZSCHOPAU        Zschopau        Zschopau        1994-01-08\r
+1      -1893313        -2603705        50.75   13.0666667      504500  130400  US62    NM33-04 P       PPL     4       GM      13                              N                               ZSCHOPAU        Zschopau        Zschopau        2002-05-02\r
+1      -1893316        -2603708        50.8666667      12.4166667      505200  122500  US13    NM33-04 P       PPL             GM      15                              N                               ZSCHOPEL        Zschöpel       Zschopel        1998-05-15\r
+1      -1893317        -2603709        50.7333333      13.0666667      504400  130400  US62    NM33-04 T       HLL             GM      13                              N                               ZSCHOPENBERG    Zschopen-Berg   Zschopen-Berg   1994-01-08\r
+1      -1893318        -2603710        50.7666667      13.1    504600  130600  US62    NM33-04 P       PPL             GM      13                              N                               ZSCHOPENTHAL    Zschopenthal    Zschopenthal    1994-01-08\r
diff --git a/gpsbabel/style/geonet.style b/gpsbabel/style/geonet.style
new file mode 100644 (file)
index 0000000..7b7d3a1
--- /dev/null
@@ -0,0 +1,49 @@
+# gpsbabel XCSV style file
+#
+# Format: GEOnet Names Server (GNS) (http://earth-info.nga.mil/gns/html/cntry_files.html)
+# Author: Olaf Klein
+#   Date: 08/20/2002
+#
+
+DESCRIPTION            GEOnet Names Server (GNS)
+EXTENSION              txt
+
+#
+# FILE LAYOUT DEFINITIIONS:
+#
+
+FIELD_DELIMITER                TAB
+RECORD_DELIMITER       CRNEWLINE
+BADCHARS               TAB
+ENCODING               UTF-8
+
+PROLOGUE               RC      UFI     UNI     LAT     LONG    DMS_LAT DMS_LONG        UTM     JOG     FC      DSG     PC      CC1     ADM1    ADM2    DIM     CC2     NT      LC      SHORT_FORM      GENERIC SORT_NAME       FULL_NAME       FULL_NAME_ND    MODIFY_DATE
+
+#
+# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:
+#
+IFIELD IGNORE, "", "%s"                # RC            ( http://earth-info.nga.mil/gns/html/gis_contryfiles.html )
+IFIELD IGNORE, "", "%s"                # UFI
+IFIELD IGNORE, "", "%s"                # UNI
+IFIELD LAT_DECIMAL, "", "%03.7f"       # LAT
+IFIELD LON_DECIMAL, "", "%03.7f"       # LONG
+IFIELD IGNORE, "", "%s"                # DMS_LAT
+IFIELD IGNORE, "", "%s"                # DMS_LONG
+IFIELD IGNORE, "", "%s"                # UTM
+IFIELD IGNORE, "", "%s"                # JOG
+IFIELD IGNORE, "", "%s"                # FC
+IFIELD IGNORE, "", "%s"                # DSG
+IFIELD IGNORE, "", "%s"                # PC
+IFIELD IGNORE, "", "%s"                # CC1
+IFIELD IGNORE, "", "%s"                # ADM1
+IFIELD IGNORE, "", "%s"                # ADM2
+IFIELD IGNORE, "", "%s"                # DIM
+IFIELD IGNORE, "", "%s"                # CC2
+IFIELD IGNORE, "", "%s"                # NT
+IFIELD IGNORE, "", "%s"                # LC
+IFIELD IGNORE, "", "%s"                # SHORT_FORM
+IFIELD IGNORE, "", "%s"                # GENERIC
+IFIELD SHORTNAME, "", "%s"             # SHORT_NAME
+IFIELD DESCRIPTION, "", "%s"           # FULL_NAME
+IFIELD IGNORE, "", "%s"                # FULL_NAME_ND
+IFIELD IGNORE, "", "%s"                # MOD_DATE
index 9cfd185d7287548f7eea41c8aff84da342a66c7a..95f3e5d86b4fc7eef5001c1e503a11df6a6b0152 100644 (file)
@@ -323,6 +323,12 @@ xcsv_parse_style_line(const char *sbuff)
            xcsv_epilogue_add(xstrdup(&sbuff[9]));
        } else
 
+       if (ISSTOKEN(sbuff, "ENCODING")) {
+           p = csv_stringtrim(&sbuff[8], "\"", 1);
+           cet_convert_init(p, 1);
+           xfree(p);
+       } else
+       
        if (ISSTOKEN(sbuff, "IFIELD")) {
            key = val = pfc = NULL;